<?php

namespace Sifast\ProjectBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\HttpFoundation\File\File;

/**
 * Conge
 *
 * @ORM\Table()
 * @Vich\Uploadable
 * @ORM\Entity(repositoryClass="Sifast\ProjectBundle\Entity\CongeRepository")
 */
class Conge {

    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @var date
     *
     * @ORM\Column(name="jour_debut", type="date", length=255)
     */
    private $jourDebut;

    /**
     * @var string
     *
     * @ORM\Column(name="resultat", type="string", length=255,nullable=true)
     */
    private $resultat;

    /**
     * @var string
     *
     * @ORM\Column(name="time_jour_debut", type="string", length=255)
     */
    private $timeJourDebut;

    /**
     * @var string
     *
     * @ORM\Column(name="time_jour_fin", type="string", length=255)
     */
    private $timeJourFin;

    /**
     * @var date
     *
     * @ORM\Column(name="jour_fin", type="date", length=255)
     */
    private $jourFin;

    /**
     * @var string
     *
     * @ORM\Column(name="motif", type="text")
     */
    private $motif;

    /**
     * @Assert\File(
     *     maxSize="1M",
     *     mimeTypes={"application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/msword","application/pdf"},
     *     mimeTypesMessage = "Ce fichier doit être une image ou une vidéo"),
     *     notFoundMessage = "Le fichier n'a pas été trouvé sur le disque",
     *     uploadErrorMessage = "Erreur dans l'upload du fichier"
     * )
     * @Vich\UploadableField(mapping="conge_attachement", fileNameProperty="attachementName")
     *
     * @var File $image
     */
    private $attachement;

    /**
     * @ORM\Column(type="string", length=255, name="attachementName")
     *
     * @var string $imageName
     */
    protected $attachementName;

    /**
     * @var integer
     *
     * @ORM\ManyToOne(targetEntity="Application\Sonata\UserBundle\Entity\User", inversedBy="id", cascade={"remove", "persist"})

     */
    private $user;

    /**
     * @var integer
     *
     * @ORM\OneToMany(targetEntity="Type", mappedBy="id", cascade={"remove", "persist"})
     * @ORM\Column(name="id_type", type="integer")
     */
    private $type;
    public function __construct() {
        $this->resultat = "En attente";
    }
    /**
     * Get id
     *
     * @return integer 
     */
    public function getId() {
        return $this->id;
    }

    /**
     * Set jourDebut
     *
     * @param string $jourDebut
     * @return Conge
     */
    public function setJourDebut($jourDebut) {
        $this->jourDebut = $jourDebut;

        return $this;
    }

    /**
     * Get jourDebut
     *
     * @return string 
     */
    public function getJourDebut() {
        return $this->jourDebut;
    }

    /**
     * Set jourFin
     *
     * @param string $jourFin
     * @return Conge
     */
    public function setJourFin($jourFin) {
        $this->jourFin = $jourFin;

        return $this;
    }

    /**
     * Get jourFin
     *
     * @return string 
     */
    public function getJourFin() {
        return $this->jourFin;
    }

    /**
     * Set motif
     *
     * @param string $motif
     * @return Conge
     */
    public function setMotif($motif) {
        $this->motif = $motif;

        return $this;
    }

    /**
     * Get motif
     *
     * @return string 
     */
    public function getMotif() {
        return $this->motif;
    }

    /**
     * Set attachement
     *
     * @param string $attachement
     * @return Conge
     */
    public function setAttachement($attachement) {
        $this->attachement = $attachement;

        return $this;
    }

    /**
     * Get attachement
     *
     * @return string 
     */
    public function getAttachement() {
        return $this->attachement;
    }

    /**
     * Set type
     *
     * @param integer $type
     * @return Conge
     */
    public function setType($type) {
        $this->type = $type;

        return $this;
    }

    /**
     * Get type
     *
     * @return integer 
     */
    public function getType() {
        return $this->type;
    }

    /**
     * Set user
     *
     * @param \Application\Sonata\UserBundle\Entity\User $user
     * @return Conge
     */
    public function setUser(\Application\Sonata\UserBundle\Entity\User $user = null) {
        $this->user = $user;
        $user->addConge($this);
        return $this;
    }

    /**
     * Get user
     *
     * @return \Application\Sonata\UserBundle\Entity\User 
     */
    public function getUser() {
        return $this->user;
    }

    /**
     * Set timeJourDebut
     *
     * @param string $timeJourDebut
     * @return Conge
     */
    public function setTimeJourDebut($timeJourDebut) {
        $this->timeJourDebut = $timeJourDebut;

        return $this;
    }

    /**
     * Get timeJourDebut
     *
     * @return string 
     */
    public function getTimeJourDebut() {
        return $this->timeJourDebut;
    }

    /**
     * Set timeJourFin
     *
     * @param string $timeJourFin
     * @return Conge
     */
    public function setTimeJourFin($timeJourFin) {
        $this->timeJourFin = $timeJourFin;

        return $this;
    }

    /**
     * Get timeJourFin
     *
     * @return string 
     */
    public function getTimeJourFin() {
        return $this->timeJourFin;
    }

    /**
     * Set attachementName
     *
     * @param string $attachementName
     * @return Conge
     */
    public function setAttachementName($attachementName) {
        $this->attachementName = $attachementName;

        return $this;
    }

    /**
     * Get attachementName
     *
     * @return string 
     */
    public function getAttachementName() {
        return $this->attachementName;
    }


    /**
     * Set resultat
     *
     * @param string $resultat
     * @return Conge
     */
    public function setResultat($resultat)
    {
        $this->resultat = $resultat;
    
        return $this;
    }

    /**
     * Get resultat
     *
     * @return string 
     */
    public function getResultat()
    {
        return $this->resultat;
    }
}